/*
*
* Replication code for "Preventing Rebel Resurgence after Civil War: A Field Experiment in Security and Justice Provision in Rural Colombia"
* American Political Science Review
* Robert A. Blair, Manuel Moscoso, Andres Vargas Castillo, and Michael Weintraub
*
*/

				clear
				set more off
				clear mata
				clear matrix
				graph set window fontface "Times"
				grstyle init
				grstyle color major_grid white



				gl dir "/Users/robertblair/Dropbox (Personal)/Documents/Research/Police Inspectors/Shared/Paper/Submissions/APSR Conditional Acceptance/replication/analysis"
				
				*gl dir "[YOUR DIRECTORY]"
				
				use "$dir/data/data.dta", clear
						
					
* Define globals for DVs


				gl P3 ijacagarb_correct ijacthr_correct ijacnoi_correct ijacrbur_correct ijaccog_correct ijacdv_correct ijacrob_correct 

				gl P3_lead $P3 		
				
				gl P4 rely_state_hyp_dum rely_state_actual_dum rely_state_others_hyp_dum

				gl P4_lead $P4 rely_state_jac_hyp_dum
				
				gl P5 garbfa_match_mode garbla_match_mode bdfa_match_mode bdla_match_mode dvfa_match_mode dvla_match_mode fafa_match_mode fala_match_mode
				 		
				gl P5_lead $P5	
						
				gl P5_match_res garbfa_match_mode_res garbla_match_mode_res bdfa_match_mode_res bdla_match_mode_res dvfa_match_mode_res dvla_match_mode_res fafa_match_mode_res fala_match_mode_res
						
				gl P5_match_lead garbfa_match_mode_lead garbla_match_mode_lead bdfa_match_mode_lead bdla_match_mode_lead dvfa_match_mode_lead dvla_match_mode_lead fafa_match_mode_lead fala_match_mode_lead
				
				gl rely_comm rely_jac_hyp_dum rely_jac_actual_dum rely_jac_others_hyp_dum

				gl rely_comm_lead $rely_comm
				
				gl rely_comm_juris rely_jac_hyp_j_dum rely_jac_actual_j_dum rely_jac_others_hyp_j_dum

				gl rely_comm_no_juris rely_jac_hyp_nj_dum rely_jac_actual_nj_dum rely_jac_others_hyp_nj_dum

				gl rely_comm_juris_lead $rely_comm_juris
				
				gl rely_comm_no_juris_lead $rely_comm_no_juris
								
				gl P7 rely_pol_pi_hyp_dum rely_pol_pi_actual_dum rely_pol_pi_others_hyp_dum 

				gl P7_lead $P7
				
				gl P7_pol rely_pol_hyp_dum rely_pol_actual_dum rely_pol_others_hyp_dum
				
				gl P7_pi rely_pi_hyp_dum rely_pi_actual_dum rely_pi_others_hyp_dum
						
				gl P7_pi_lead $P7_pi
						
				gl P7_juris rely_pol_hyp_j_dum rely_pi_hyp_j_dum rely_pol_actual_j_dum rely_pi_actual_j_dum rely_pol_others_hyp_j_dum rely_pi_others_hyp_j_dum

				gl P7_juris_lead $P7_juris

				gl P7_no_juris rely_pol_hyp_nj_dum rely_pi_hyp_nj_dum rely_pol_actual_nj_dum rely_pi_actual_nj_dum rely_pol_others_hyp_nj_dum rely_pi_others_hyp_nj_dum

				gl P7_no_juris_lead $P7_juris
			
				gl P8 rely_ag_hyp_dum rely_ag_actual_dum rely_ag_others_hyp_dum rely_ag_others_dum
				
				gl P8_lead $P8 helpag_jac_dum 				
				
				gl S3_lead jac_confianza jac_meetings_month jac_harmony
						
				gl S4_lead piphone_yes polphone_yes suipjac_dum supojac_dum conjacpi conjacpo copijac cohpijac
												
				gl S4_pi nbr_jac_pi_yes cont_com_pi freq_vst_pi_dum
				
				gl S4_pol nbr_jac_pol_yes cont_com_pol freq_vst_pol_dum
								
				gl S5 trustpol_dum_alt knowpol_dum_alt resolpol_dum_alt trustpi_dum_alt knowpi_dum_alt resolpi_dum_alt
				
				gl S6 trustjac_dum_alt knowjac_dum_alt resoljac_dum_alt
								
				gl S7 trustag_dum_alt knowag_dum_alt resolag_dum_alt fairag_dum
				
				gl S7_lead $S7
				
				
				
				
* Define globals for sources of treatment effect heterogeneity

				gl HTE_victimization vict_idx_std vict_ag_idx_std vict_reb_idx_std vict_para_idx_std vict_state_idx_std
					
				gl HTE_governance ag_gov_idx_std rebel_gov_idx_std para_gov_idx_std
			
				
* Define global for individual-level controls
			
				gl i_ctrls age male ihresid quality_walls quality_floors preschool primary_school middle_school employed 
			
	
* Define global for community-level controls 

				gl c_ctrls ipopulation hubdist km minutes 
	
		
* Define globals for block FE

				gl block_FE block_FE*
			
			
* Load programs

				do "$dir/do/avg_effect_weighted.do"

				do "$dir/do/multi_comparison.do"
				
				
				
	
	
	
	
		
***********
***********
*  PAPER  *
***********
***********




* Table 1: Prevalence of unresolved and violent disputes
	
			foreach y of varlist unresolved_dum iverb_phys_dum {
						
				areg `y' assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg `y' assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				}
						
				esttab unresolved_dum_ITT_res unresolved_dum_ITT_lead iverb_phys_dum_ITT_res iverb_phys_dum_ITT_lead using "$dir/tables/table1.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") mgroups("\textbf{\shortstack{Any unresolved\\disputes}}" "\textbf{\shortstack{Any violent\\disputes}}" , pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" )				
	
	
	
	
* Table 2: Reliance on armed groups and state and communal authorities to resolve disputes

			foreach y in rely_comm P7 P8 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				}
	
				esttab P8_ITT_res P8_ITT_lead rely_comm_ITT_res rely_comm_ITT_lead P7_ITT_res P7_ITT_lead using "$dir/tables/table2.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Reliance on \\ armed groups}}" "\textbf{Reliance on JACs}" "\textbf{\shortstack{Reliance on police \\ and PIs}}", pattern(1 0 1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
					
					
					
					
	
* Table 3: Information about communities and Colombian law
				
				avg_effect_weighted_reg $P3 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P3_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $P3_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P3_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				areg disp_match assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
					eststo disp_match_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
						
				areg disp_match_pol assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
					eststo disp_match_ITT_pol
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
				
				areg disp_match_pi assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
					eststo disp_match_ITT_pi
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				esttab P3_ITT_res P3_ITT_lead disp_match_ITT_lead disp_match_ITT_pol disp_match_ITT_pi using "$dir/tables/table3.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Leaders" "Police" "PIs") ///
					mgroups("\textbf{\shortstack{Understanding of \\ JACs' authority}}" "\textbf{\shortstack{Understanding of most \\ important disputes}}", pattern(1 0 1 0 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						
						
						
						
				
* Table 4: Perceptions of armed groups and state and communal authorities

			foreach y in S5 S6 S7 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				}
						
				areg trust_jac_yes_pol assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
					eststo trust_jac_yes_ITT_pol
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
				
				areg trust_jac_yes_pi assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
					eststo trust_jac_yes_ITT_pi
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				esttab S7_ITT_res S7_ITT_lead S6_ITT_res trust_jac_yes_ITT_pol trust_jac_yes_ITT_pi S5_ITT_res S5_ITT_lead using "$dir/tables/table4.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Police" "PIs" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Perceptions of\\armed groups}}" "\textbf{\shortstack{Perceptions of JACs}}" "\textbf{\shortstack{Perceptions of police \\ and PIs}}", pattern(1 0 1 0 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
			
			
			
			
			
* Table 5: Perceptions of armed groups and governmental and communal institutions among residents using endorsement experiment
				
				local title endorse_approve_idx_std
				local label: var label endorse_approve_idx_std

				areg endorse_approve_idx_std assigned ///
					endorse_assign_jac endorse_assign_pol endorse_assign_ag ///
					assigned_endorse_assign_jac assigned_endorse_assign_pol assigned_endorse_assign_ag $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
						eststo endorse_approve_idx_std_res
							estadd local i_ctrls "Yes"
							estadd local c_ctrls "Yes"
							estadd local block_FE "Yes"
							estadd local weights "Yes"
							estadd local estimator "OLS"
				
				esttab endorse_approve_idx_std_res using "$dir/tables/table5.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					keep(assigned ///
					endorse_assign_jac endorse_assign_pol endorse_assign_ag ///
					assigned_endorse_assign_jac assigned_endorse_assign_pol assigned_endorse_assign_ag) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes nonumber scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 

				
				
				
				
* Table 6: Coordination between and among governmental and communal institutions

				avg_effect_weighted_reg $P5 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P5_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $P5_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P5_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $S4_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo S4_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"						
		
				avg_effect_weighted_reg $S4_pol if num_resp==1, effectvar(assigned) controltest(assigned==0) x(assigned $c_ctrls $block_FE) ap(IPW)
					eststo S4_ITT_pol
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $S4_pi if num_resp==1, effectvar(assigned) controltest(assigned==0) x(assigned $c_ctrls $block_FE) ap(IPW)
					eststo S4_ITT_pi
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
		
				avg_effect_weighted_reg $S3_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo S3_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"						
						

				esttab P5_ITT_res P5_ITT_lead S4_ITT_lead S4_ITT_pol S4_ITT_pi S3_ITT_lead using "$dir/tables/table6.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Leaders" "Police" "PIs" "Leaders") ///
					mgroups("\textbf{\shortstack{Consensus around \\ dispute resolution}}" "\textbf{\shortstack{Coordination between JACs, \\ police, and PIs}}" "\textbf{\shortstack{Coordination \\ within JACs}}", pattern(1 0 1 0 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
				

				
			
* Table 7: Demand for coordination between state and communal authorities using behavioral measures

				foreach y of varlist Petitions_dum Petitions WhatsApp_Group {
							
			areg `y' assigned $c_ctrls [pweight = IPW] if num_resp==1,  ab(block)
				eststo `y'
					estadd local i_ctrls "No"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "OLS"
				}
				
				esttab Petitions_dum Petitions WhatsApp_Group using "$dir/tables/table7.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("\textbf{Any petitions}" "\textbf{\# of petitions}" "\textbf{\shortstack{WhatsApp group}}" ) ///
					keep(assigned) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 

					

		
**************
**************
*  APPENDIX  *
**************
**************

			

			
			
* Table A.1: Balance
		
				la var assigned "\textbf{\shortstack{Assigned to treatment}}"
		
				areg assigned ipopulation hubdist km minutes icoca_t_1_c iPNIS_18 if num_resp==1, ab(block) 
					test ipopulation hubdist km minutes icoca_t_1_c iPNIS_18 
						local c_balance_F = round(r(F),.001)
						local c_balance_F_p = round(r(p),.001)
				
				areg assigned ipopulation hubdist km minutes icoca_t_1_c iPNIS_18 if num_resp==1, ab(block) 
					eststo c_balance
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "No"
						estadd local estimator "OLS"
						estadd local balance_F "`c_balance_F'"
						estadd local balance_F_p "`c_balance_F_p'"
			
				esttab c_balance using "$dir/tables/tablea1.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					keep(ipopulation hubdist km minutes icoca_t_1_c iPNIS_18) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes nonumber scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" "balance_F F" "balance_F_p p(F)") 
			
				la var assigned "Assigned to treatment"

			
			
* Table A.2: Resident and leader characteristics
			
				estpost summarize $i_ctrls if leader==0
					eststo summstats_res
				estpost summarize $i_ctrls if leader==1
					eststo summstats_lead
				esttab summstats_res summstats_lead using "$dir/tables/tablea2.tex", replace ///	
					booktabs cell((mean(label(Mean) fmt(%9.2f)) sd(label(S.D.) fmt(%9.2f)) count(label(N) fmt(%9.0f)))) mtitle("Residents" "Leaders" ) noobs nonumber nonotes label

					
				
* Table A.3: Community characteristics
	
				estpost summarize ipopulation hubdist km minutes icoca_t_1_c iPNIS_18 if num_resp==1
					eststo summstats_comm
				esttab summstats_comm using "$dir/tables/tablea3.tex", replace ///	
					booktabs cell((mean(label(Mean) fmt(%9.2f)) sd(label(S.D.) fmt(%9.2f)) count(label(N) fmt(%9.0f)))) noobs nonumber nomtitle nonotes label
			
			
			
* Table A.4: Manipulation check

			foreach y of varlist heaprog comunpaz {
						
				areg `y' assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg `y' assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				}
						
				esttab heaprog_ITT_res heaprog_ITT_lead comunpaz_ITT_res comunpaz_ITT_lead using "$dir/tables/tablea4.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") mgroups("\textbf{\shortstack{Heard of dispute \\ resolution program}}" "\textbf{\shortstack{Heard of \\ \textit{ComunPaz} program}}" , pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						
								

								
* Table A.5: Prevalence of unresolved and violent disputes with multiple comparisons corrections

			mat disputes = J(4,1,.)
			
			mat rownames disputes = unresolved_dum_res unresolved_dum_lead iverb_phys_dum_res iverb_phys_dum_lead

			areg unresolved_dum assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block)				
				mat disputes[1,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			areg unresolved_dum assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block)
				mat disputes[2,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			areg iverb_phys_dum assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block)
				mat disputes[3,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			areg iverb_phys_dum assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block)
				mat disputes[4,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
				
			bhcorr, mat(disputes) newname(pvalue) outmat(disputes_bhcorr)
			holmscorr, mat(disputes) newname(pvalue) fwer(0.1) outmat(disputes_holmscorr)
				
			local bhcorr_unresolved_dum_res = round(disputes_bhcorr[1,2],.001)
			local bhcorr_iverb_phys_dum_res = round(disputes_bhcorr[3,2],.001)
			local bhcorr_unresolved_dum_lead = round(disputes_bhcorr[2,2],.001)
			local bhcorr_iverb_phys_dum_lead = round(disputes_bhcorr[4,2],.001)

			local holmscorr_unresolved_dum_res = round(disputes_holmscorr[1,4],.001)
			local holmscorr_unresolved_dum_lead = round(disputes_holmscorr[2,4],.001)
			local holmscorr_iverb_phys_dum_res = round(disputes_holmscorr[3,4],.001)
			local holmscorr_iverb_phys_dum_lead = round(disputes_holmscorr[4,4],.001)

			local pvalue_unresolved_dum_res = round(disputes_holmscorr[1,1],.001)
			local pvalue_unresolved_dum_lead = round(disputes_holmscorr[2,1],.001)
			local pvalue_iverb_phys_dum_res = round(disputes_holmscorr[3,1],.001)
			local pvalue_iverb_phys_dum_lead = round(disputes_holmscorr[4,1],.001)
			
			foreach y of varlist unresolved_dum iverb_phys_dum {
						
				areg `y' assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
						estadd local pval "`pvalue_`y'_res'"
						estadd local qval "`bhcorr_`y'_res'"
						estadd local hb_pval "`holmscorr_`y'_res'"
						
				areg `y' assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
						estadd local pval "`pvalue_`y'_lead'"
						estadd local qval "`bhcorr_`y'_lead'"
						estadd local hb_pval "`holmscorr_`y'_lead'"

				}
						
				esttab unresolved_dum_ITT_res unresolved_dum_ITT_lead iverb_phys_dum_ITT_res iverb_phys_dum_ITT_lead using "$dir/tables/tablea5.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") mgroups("\textbf{\shortstack{Any unresolved\\disputes}}" "\textbf{\shortstack{Any violent\\disputes}}" , pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" "pval p-value" "qval B-H q-value" "hb_pval H-B threshold") 
						
	
	
* Table A.6: Reliance on armed groups and state and communal authorities to resolve disputes with multiple comparisons corrections


			mat reliance = J(6,1,.)
			
			mat rownames reliance = rely_comm_ITT_res rely_comm_ITT_lead P7_ITT_res P7_ITT_lead P8_ITT_res P8_ITT_lead

			avg_effect_weighted_reg $rely_comm if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)				
				mat reliance[1,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $rely_comm if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat reliance[2,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $P7 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)				
				mat reliance[3,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $P7 if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat reliance[4,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $P8 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)				
				mat reliance[5,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $P8 if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat reliance[6,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
				
			bhcorr, mat(reliance) newname(pvalue) outmat(reliance_bhcorr)
			holmscorr, mat(reliance) newname(pvalue) fwer(0.1) outmat(reliance_holmscorr)
				
			local bhcorr_rely_comm_res = round(reliance_bhcorr[1,2],.001)
			local bhcorr_rely_comm_lead = round(reliance_bhcorr[2,2],.001)
			local bhcorr_P7_res = round(reliance_bhcorr[3,2],.001)
			local bhcorr_P7_lead = round(reliance_bhcorr[4,2],.001)
			local bhcorr_P8_res = round(reliance_bhcorr[5,2],.001)
			local bhcorr_P8_lead = round(reliance_bhcorr[6,2],.001)

			local holmscorr_rely_comm_res = round(reliance_holmscorr[1,4],.001)
			local holmscorr_rely_comm_lead = round(reliance_holmscorr[2,4],.001)
			local holmscorr_P7_res = round(reliance_holmscorr[3,4],.001)
			local holmscorr_P7_lead = round(reliance_holmscorr[4,4],.001)
			local holmscorr_P8_res = round(reliance_holmscorr[5,4],.001)
			local holmscorr_P8_lead = round(reliance_holmscorr[6,4],.001)

			local pvalue_rely_comm_res = round(reliance_holmscorr[1,1],.001)
			local pvalue_rely_comm_lead = round(reliance_holmscorr[2,1],.001)
			local pvalue_P7_res = round(reliance_holmscorr[3,1],.001)
			local pvalue_P7_lead = round(reliance_holmscorr[4,1],.001)
			local pvalue_P8_res = round(reliance_holmscorr[5,1],.001)
			local pvalue_P8_lead = round(reliance_holmscorr[6,1],.001)
				
			foreach y in rely_comm P7 P8 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						estadd local pval "`pvalue_`y'_res'"
						estadd local qval "`bhcorr_`y'_res'"
						estadd local hb_pval "`holmscorr_`y'_res'"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						estadd local pval "`pvalue_`y'_lead'"
						estadd local qval "`bhcorr_`y'_lead'"
						estadd local hb_pval "`holmscorr_`y'_lead'"
						
				}
	
				esttab P8_ITT_res P8_ITT_lead rely_comm_ITT_res rely_comm_ITT_lead P7_ITT_res P7_ITT_lead using "$dir/tables/tablea6.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Reliance on \\ armed groups}}" "\textbf{Reliance on JACs}" "\textbf{\shortstack{Reliance on police \\ and PIs}}", pattern(1 0 1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" "pval p-value" "qval B-H q-value" "hb_pval H-B threshold") 
											
	
	
	
* Table A.7: Information about communities and Colombian law with multiple comparisons corrections


			mat information = J(5,1,.)
			
			mat rownames information = P3_ITT_res P3_ITT_lead disp_match_ITT_lead disp_match_ITT_pol disp_match_ITT_pi

			avg_effect_weighted_reg $P3 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat information[1,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $P3 if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat information[2,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			areg disp_match assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
				mat information[3,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			areg disp_match_pol assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
				mat information[4,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			areg disp_match_pi assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
				mat information[5,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
					
			bhcorr, mat(information) newname(pvalue) outmat(information_bhcorr)
			holmscorr, mat(information) newname(pvalue) fwer(0.1) outmat(information_holmscorr)
			
			local bhcorr_P3_res = round(information_bhcorr[1,2],.001)
			local bhcorr_P3_lead = round(information_bhcorr[2,2],.001)
			local bhcorr_dispmatch_lead = round(information_bhcorr[3,2],.001)
			local bhcorr_dispmatch_pol = round(information_bhcorr[4,2],.001)
			local bhcorr_dispmatch_pi = round(information_bhcorr[5,2],.001)

			local holmscorr_P3_res = round(information_holmscorr[1,4],.001)
			local holmscorr_P3_lead = round(information_holmscorr[2,4],.001)
			local holmscorr_dispmatch_lead = round(information_holmscorr[3,4],.001)
			local holmscorr_dispmatch_pol = round(information_holmscorr[4,4],.001)
			local holmscorr_dispmatch_pi = round(information_holmscorr[5,4],.001)
		
			local pvalue_P3_res = round(information_holmscorr[1,1],.001)
			local pvalue_P3_lead = round(information_holmscorr[2,1],.001)
			local pvalue_dispmatch_lead = round(information_holmscorr[3,1],.001)
			local pvalue_dispmatch_pol = round(information_holmscorr[4,1],.001)
			local pvalue_dispmatch_pi = round(information_holmscorr[5,1],.001)
	
			avg_effect_weighted_reg $P3 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				eststo P3_ITT_res
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"
					estadd local pval "`pvalue_P3_res'"
					estadd local qval "`bhcorr_P3_res'"
					estadd local hb_pval "`holmscorr_P3_res'"

			avg_effect_weighted_reg $P3_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				eststo P3_ITT_lead
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"
					estadd local pval "`pvalue_P3_lead'"
					estadd local qval "`bhcorr_P3_lead'"
					estadd local hb_pval "`holmscorr_P3_lead'"
					
			areg disp_match assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
				eststo disp_match_ITT_lead
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "OLS"
					estadd local pval "`pvalue_dispmatch_lead'"
					estadd local qval "`bhcorr_dispmatch_lead'"
					estadd local hb_pval "`holmscorr_dispmatch_lead'"
					
			areg disp_match_pol assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
				eststo disp_match_ITT_pol
					estadd local i_ctrls "No"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "OLS"
					estadd local pval "`pvalue_dispmatch_pol'"
					estadd local qval "`bhcorr_dispmatch_pol'"
					estadd local hb_pval "`holmscorr_dispmatch_pol'"
			
			areg disp_match_pi assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
				eststo disp_match_ITT_pi
					estadd local i_ctrls "No"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "OLS"
					estadd local pval "`pvalue_dispmatch_pi'"
					estadd local qval "`bhcorr_dispmatch_pi'"
					estadd local hb_pval "`holmscorr_dispmatch_pi'"

			esttab P3_ITT_res P3_ITT_lead disp_match_ITT_lead disp_match_ITT_pol disp_match_ITT_pi using "$dir/tables/tablea7.tex", replace ///
				rename(ae_assigned assigned) ///
				label booktabs b(3) se(3) eqlabels(none) br ///
				mtitle("Residents" "Leaders" "Leaders" "Police" "PIs") ///
				mgroups("\textbf{\shortstack{Understanding of \\ JACs' authority}}" "\textbf{\shortstack{Understanding of most \\ important disputes}}", pattern(1 0 1 0 0) ///
				prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
				keep(assigned) coeflabel(assigned "Assigned to treatment") ///
				star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" "pval p-value" "qval B-H q-value" "hb_pval H-B threshold") 
					
	
	
	
* Table A.8: Perceptions of armed groups and state and communal authorities with multiple comparisons corrections

			mat perceptions = J(7,1,.)

			mat rownames perceptions = S7_ITT_res S7_ITT_lead S6_ITT_res trust_jac_yes_ITT_pol trust_jac_yes_ITT_pi S5_ITT_res S5_ITT_lead

			avg_effect_weighted_reg $S7 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat perceptions[1,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S7 if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat perceptions[2,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S6 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat perceptions[3,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			areg trust_jac_yes_pol assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
				mat perceptions[4,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			areg trust_jac_yes_pi assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
				mat perceptions[5,1] = 2*ttail(e(df_r), abs(_b[assigned]/_se[assigned]))
			avg_effect_weighted_reg $S5 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat perceptions[6,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S5 if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat perceptions[7,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))

			bhcorr, mat(perceptions) newname(pvalue) outmat(perceptions_bhcorr)
			holmscorr, mat(perceptions) newname(pvalue) fwer(0.1) outmat(perceptions_holmscorr)

			local bhcorr_S7_res = round(perceptions_bhcorr[1,2],.001)
			local bhcorr_S7_lead = round(perceptions_bhcorr[2,2],.001)
			local bhcorr_S6_res = round(perceptions_bhcorr[3,2],.001)
			local bhcorr_trust_jac_yes_pol = round(perceptions_bhcorr[4,2],.001)
			local bhcorr_trust_jac_yes_pi = round(perceptions_bhcorr[5,2],.001)
			local bhcorr_S5_res = round(perceptions_bhcorr[6,2],.001)
			local bhcorr_S5_lead = round(perceptions_bhcorr[7,2],.001)

			local holmscorr_S7_res = round(perceptions_holmscorr[1,4],.001)
			local holmscorr_S7_lead = round(perceptions_holmscorr[2,4],.001)
			local holmscorr_S6_res = round(perceptions_holmscorr[3,4],.001)
			local holmscorr_trust_jac_yes_pol = round(perceptions_holmscorr[4,4],.001)
			local holmscorr_trust_jac_yes_pi = round(perceptions_holmscorr[5,4],.001)
			local holmscorr_S5_res = round(perceptions_holmscorr[6,4],.001)
			local holmscorr_S5_lead = round(perceptions_holmscorr[7,4],.001)

			local pvalue_S7_res = round(perceptions_holmscorr[1,1],.001)
			local pvalue_S7_lead = round(perceptions_holmscorr[2,1],.001)
			local pvalue_S6_res = round(perceptions_holmscorr[3,1],.001)
			local pvalue_trust_jac_yes_pol = round(perceptions_holmscorr[4,1],.001)
			local pvalue_trust_jac_yes_pi = round(perceptions_holmscorr[5,1],.001)
			local pvalue_S5_res = round(perceptions_holmscorr[6,1],.001)
			local pvalue_S5_lead = round(perceptions_holmscorr[7,1],.001)

			foreach y in S5 S6 S7 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						estadd local pval "`pvalue_`y'_res'"
						estadd local qval "`bhcorr_`y'_res'"
						estadd local hb_pval "`holmscorr_`y'_res'"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						estadd local pval "`pvalue_`y'_lead'"
						estadd local qval "`bhcorr_`y'_lead'"
						estadd local hb_pval "`holmscorr_`y'_lead'"
						
				}
						
				areg trust_jac_yes_pol assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
					eststo trust_jac_yes_ITT_pol
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
						estadd local pval "`pvalue_trust_jac_yes_pol'"
						estadd local qval "`bhcorr_trust_jac_yes_pol'"
						estadd local hb_pval "`holmscorr_trust_jac_yes_pol'"
				
				areg trust_jac_yes_pi assigned $c_ctrls [pweight = IPW] if num_resp==1, ab(block) 
					eststo trust_jac_yes_ITT_pi
						estadd local i_ctrls "No"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
						estadd local pval "`pvalue_trust_jac_yes_pi'"
						estadd local qval "`bhcorr_trust_jac_yes_pi'"
						estadd local hb_pval "`holmscorr_trust_jac_yes_pi'"

				esttab S7_ITT_res S7_ITT_lead S6_ITT_res trust_jac_yes_ITT_pol trust_jac_yes_ITT_pi S5_ITT_res S5_ITT_lead using "$dir/tables/tablea8.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Police" "PIs" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Perceptions of\\armed groups}}" "\textbf{\shortstack{Perceptions of JACs}}" "\textbf{\shortstack{Perceptions of police \\ and PIs}}", pattern(1 0 1 0 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" "pval p-value" "qval B-H q-value" "hb_pval H-B threshold") 

					
			
			
			
			

	
* Table A.9: Coordination between and among governmental and communal authorities with multiple comparisons corrections

			mat coordination = J(6,1,.)

			mat rownames coordination = P5_ITT_res P5_ITT_lead S4_ITT_lead S4_ITT_pol S4_ITT_pi S3_ITT_lead

			avg_effect_weighted_reg $P5 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat coordination[1,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $P5_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat coordination[2,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S4_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat coordination[3,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S4_pol if num_resp==1, effectvar(assigned) controltest(assigned==0) x(assigned $c_ctrls $block_FE) ap(IPW)
				mat coordination[4,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S4_pi if num_resp==1, effectvar(assigned) controltest(assigned==0) x(assigned $c_ctrls $block_FE) ap(IPW)
				mat coordination[5,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))
			avg_effect_weighted_reg $S3_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				mat coordination[6,1] = 2*(1-normal(abs(_b[ae_assigned]/_se[ae_assigned])))

			bhcorr, mat(coordination) newname(pvalue) outmat(coordination_bhcorr)
			holmscorr, mat(coordination) newname(pvalue) fwer(0.1) outmat(coordination_holmscorr)

			local bhcorr_P5_res = round(coordination_bhcorr[1,2],.001)
			local bhcorr_P5_lead = round(coordination_bhcorr[2,2],.001)
			local bhcorr_S4_lead = round(coordination_bhcorr[3,2],.001)
			local bhcorr_S4_pol = round(coordination_bhcorr[4,2],.001)
			local bhcorr_S4_pi = round(coordination_bhcorr[5,2],.001)
			local bhcorr_S3_lead = round(coordination_bhcorr[6,2],.001)

			local holmscorr_P5_res = round(coordination_holmscorr[1,4],.001)
			local holmscorr_P5_lead = round(coordination_holmscorr[2,4],.001)
			local holmscorr_S4_lead = round(coordination_holmscorr[3,4],.001)
			local holmscorr_S4_pol = round(coordination_holmscorr[4,4],.001)
			local holmscorr_S4_pi = round(coordination_holmscorr[5,4],.001)
			local holmscorr_S3_lead = round(coordination_holmscorr[6,4],.001)

			local pvalue_P5_res = round(coordination_holmscorr[1,1],.001)
			local pvalue_P5_lead = round(coordination_holmscorr[2,1],.001)
			local pvalue_S4_lead = round(coordination_holmscorr[3,1],.001)
			local pvalue_S4_pol = round(coordination_holmscorr[4,1],.001)
			local pvalue_S4_pi = round(coordination_holmscorr[5,1],.001)
			local pvalue_S3_lead = round(coordination_holmscorr[6,1],.001)

			avg_effect_weighted_reg $P5 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				eststo P5_ITT_res
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"
					estadd local pval "`pvalue_P5_res'"
					estadd local qval "`bhcorr_P5_res'"
					estadd local hb_pval "`holmscorr_P5_res'"

			avg_effect_weighted_reg $P5_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				eststo P5_ITT_lead
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"
					estadd local pval "`pvalue_P5_lead'"
					estadd local qval "`bhcorr_P5_lead'"
					estadd local hb_pval "`holmscorr_P5_lead'"

			avg_effect_weighted_reg $S4_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				eststo S4_ITT_lead
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"						
					estadd local pval "`pvalue_S4_lead'"
					estadd local qval "`bhcorr_S4_lead'"
					estadd local hb_pval "`holmscorr_S4_lead'"
	
			avg_effect_weighted_reg $S4_pol if num_resp==1, effectvar(assigned) controltest(assigned==0) x(assigned $c_ctrls $block_FE) ap(IPW)
				eststo S4_ITT_pol
					estadd local i_ctrls "No"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"
					estadd local pval "`pvalue_S4_pol'"
					estadd local qval "`bhcorr_S4_pol'"
					estadd local hb_pval "`holmscorr_S4_pol'"

			avg_effect_weighted_reg $S4_pi if num_resp==1, effectvar(assigned) controltest(assigned==0) x(assigned $c_ctrls $block_FE) ap(IPW)
				eststo S4_ITT_pi
					estadd local i_ctrls "No"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"
					estadd local pval "`pvalue_S4_pi'"
					estadd local qval "`bhcorr_S4_pi'"
					estadd local hb_pval "`holmscorr_S4_pi'"
	
			avg_effect_weighted_reg $S3_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
				eststo S3_ITT_lead
					estadd local i_ctrls "Yes"
					estadd local c_ctrls "Yes"
					estadd local block_FE "Yes"
					estadd local weights "Yes"
					estadd local estimator "AES"						
					estadd local pval "`pvalue_S4_lead'"
					estadd local qval "`bhcorr_S4_lead'"
					estadd local hb_pval "`holmscorr_S4_lead'"
					

			esttab P5_ITT_res P5_ITT_lead S4_ITT_lead S4_ITT_pol S4_ITT_pi S3_ITT_lead using "$dir/tables/tablea9.tex", replace ///
				rename(ae_assigned assigned) ///
				label booktabs b(3) se(3) eqlabels(none) br ///
				mtitle("Residents" "Leaders" "Leaders" "Police" "PIs" "Leaders") ///
				mgroups("\textbf{\shortstack{Consensus around \\ dispute resolution}}" "\textbf{\shortstack{Coordination between JACs, \\ police, and PIs}}" "\textbf{\shortstack{Coordination \\ within JACs}}", pattern(1 0 1 0 0 1 0) ///
				prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
				keep(assigned) coeflabel(assigned "Assigned to treatment") ///
				star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" "pval p-value" "qval B-H q-value" "hb_pval H-B threshold") 
			
	
	

	
* Table A.10: Item counts in list experiment
	
			estpost tabulate list_count if leader==0 & list_assign==0, nototal
				eststo summstats_list_ctrl
			estpost tabulate list_count if leader==0 & list_assign==1, nototal
				eststo summstats_list_treat
			esttab summstats_list_ctrl summstats_list_treat using "$dir/tables/tablea10.tex", replace ///	
				booktabs cell((b(label(Frequency) fmt(%9.0f)) pct(label(Percentage) fmt(%9.2f)))) mtitle("\textbf{Control}" "\textbf{Treatment}" ) noobs nonumber  nonotes label
							
				
				
				
* Table A.11: Reliance on armed groups among residents using list experiment
	
		kict ls list_count assigned $i_ctrls $c_ctrls block_FE* [pweight = IPW] if leader==0, condition(list_assign) nn(4) estimator(linear) vce(cluster centercode)
			
			
			
			
* Table A.12: Respect for government authority

				avg_effect_weighted_reg $P4 if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P4_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $P4_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P4_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
							
				esttab P4_ITT_res P4_ITT_lead using "$dir/tables/tablea12.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" ) ///
					mgroups("\textbf{\shortstack{Respect for \\ government authority}}" , pattern(1 0 ) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						

					
* Table A.13: Reliance on direct mediation to resolve disputes
						
				areg rely_self_hyp_dum assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					eststo rely_self_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg rely_self_hyp_dum assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
					eststo rely_self_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
										
				esttab rely_self_ITT_res rely_self_ITT_lead using "$dir/tables/tablea13.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" ) mgroups("\textbf{\shortstack{Direct mediation \\ for dispute resolution}}", pattern(1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 

			
				
						
* Table A.14: Reliance on multiple authorities to resolve disputes
	
				
				avg_effect_weighted_reg rely_multi_hyp_dum rely_multi_actual_dum if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo rely_multi_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg rely_multi_hyp_dum rely_multi_actual_dum if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo rely_multi_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
							
				esttab rely_multi_ITT_res rely_multi_ITT_lead using "$dir/tables/tablea14.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" ) ///
					mgroups("\textbf{\shortstack{Reliance on \\ multiple authorities}}", pattern(1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
									
	
	
						
* Table A.15: Absence of disputes
						
				areg no_disp_alt assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					eststo no_disp_alt_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg no_disp_alt assigned $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 
					eststo no_disp_alt_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"
										
				esttab no_disp_alt_ITT_res no_disp_alt_ITT_lead using "$dir/tables/tablea15.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" ) mgroups("\textbf{\shortstack{No disputes}}", pattern(1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 

					
				
		


* Figure A.1: Perceptions of armed groups and governmental and communal institutions among residents using endorsement experiment

				areg endorse_approve_idx_std assigned##endorse_assign_jac assigned##endorse_assign_pol assigned##endorse_assign_ag $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					margins, at(assigned=(0 1) endorse_assign_jac=(0 1))
						mplotoffset, offset(.03) name(endorsement_jac, replace) graphr(color(white))  /// 
							title("JAC endorsement", color(black)) legend(pos(2) ring(0)) ///
							plot( , label("No endorsement" "Endorsement")) ///
							ytitle("Index of approval", margin(medsmall)) ylabel(-1(.5).5) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 								
							
				areg endorse_approve_idx_std assigned##endorse_assign_jac assigned##endorse_assign_pol assigned##endorse_assign_ag $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					margins, at(assigned=(0 1) endorse_assign_pol=(0 1))
						mplotoffset, offset(.03) name(endorsement_pol, replace) graphr(color(white))  /// 
							title("Police endorsement", color(black)) legend(pos(2) ring(0)) ///
							plot( , label("No endorsement" "Endorsement")) ///
							ytitle("Index of approval", margin(medsmall)) ylabel(-1(.5).5) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 
												
				areg endorse_approve_idx_std assigned##endorse_assign_jac assigned##endorse_assign_pol assigned##endorse_assign_ag $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 
					margins, at(assigned=(0 1) endorse_assign_ag=(0 1))
						mplotoffset, offset(.03) name(endorsement_ag, replace) graphr(color(white))  /// 
							title("Armed group endorsement", color(black)) legend(pos(2) ring(0)) ///
							plot( , label("No endorsement" "Endorsement")) ///
							ytitle("Index of approval", margin(medsmall)) ylabel(-1(.5).5) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 
								
						grc1leg endorsement_jac endorsement_pol endorsement_ag, row(1) legendfrom(endorsement_jac) ycommon
							gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
							gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
								
						graph export "$dir/figures/figurea1.jpg", as(jpg) replace
						graph export "$dir/figures/figurea1.pdf", as(pdf) replace
			
					
* Table A.16: Prevalence of unresolved and violent disputes, heterogeneity by connectedness

			foreach y of varlist unresolved_dum iverb_phys_dum {
						
				areg `y' assigned conn_l_m_dummy assigned_conn_l_m_dummy $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					eststo `y'_HTE_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg `y' assigned conn_l_m_dummy assigned_conn_l_m_dummy $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					eststo `y'_HTE_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				}
				
				esttab unresolved_dum_HTE_res unresolved_dum_HTE_lead iverb_phys_dum_HTE_res iverb_phys_dum_HTE_lead using "$dir/tables/tablea16.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") mgroups("\textbf{\shortstack{Any unresolved\\disputes}}" "\textbf{\shortstack{Any violent\\disputes}}" , pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned conn_l_m_dummy assigned_conn_l_m_dummy) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 

					
					
* Figure A.2: Prevalence of unresolved and violent disputes, heterogeneity by connectedness

				areg unresolved_dum assigned##conn_l_m_dummy $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					margins, at(assigned=(0 1) conn_l_m_dummy=(0 1))
						mplotoffset, offset(.03) name(hte_unresolved_connected_res, replace) graphr(color(white))  /// 
							plot( , label("Unconnected" "Connected")) ///
							title("") legend(pos(2) ring(0)) ///
							ytitle("Any unresolved disputes (residents)", margin(medsmall)) ylabel(0(.25).75) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 
	
				areg unresolved_dum assigned##conn_l_m_dummy $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					margins, at(assigned=(0 1) conn_l_m_dummy=(0 1))
						mplotoffset, offset(.03) name(hte_unresolved_connected_lead, replace) graphr(color(white))  /// 
							plot( , label("Unconnected" "Connected")) ///
							title("") legend(pos(2) ring(0)) ///
							ytitle("Any unresolved disputes (leaders)", margin(medsmall)) ylabel(0(.25).75) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 
	
				areg iverb_phys_dum assigned##conn_l_m_dummy $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					margins, at(assigned=(0 1) conn_l_m_dummy=(0 1))
						mplotoffset, offset(.03) name(hte_violent_connected_res, replace) graphr(color(white))  /// 
							plot( , label("Unconnected" "Connected")) ///
							title("") legend(pos(2) ring(0)) ///
							ytitle("Any violent disputes (residents)", margin(medsmall)) ylabel(0(.1).3) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 
	
				areg iverb_phys_dum assigned##conn_l_m_dummy $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					margins, at(assigned=(0 1) conn_l_m_dummy=(0 1))
						mplotoffset, offset(.03) name(hte_violent_connected_lead, replace) graphr(color(white))  /// 
							plot( , label("Unconnected" "Connected")) ///
							title("") legend(pos(2) ring(0)) ///
							ytitle("Any violent disputes (leaders)", margin(medsmall)) ylabel(0(.1).3) ///
							xtitle("Assigned to treatment", margin(medsmall)) xlabel(0 "Control" 1 "Treatment") ///
							plot1opts(msymbol(square) mcolor(black) lcolor(black) lpattern(dash)) ci1opts(lcolor(black) lpattern(dash)) ///
							plot2opts(msymbol(circle) mcolor(black) lcolor(black) lpattern(solid)) ci2opts(lcolor(black) lpattern(solid)) 
	
				grc1leg hte_unresolved_connected_res hte_unresolved_connected_lead hte_violent_connected_res hte_violent_connected_lead, legendfrom(hte_unresolved_connected_res)
					gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
					gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy

						graph export "$dir/figures/figurea2.jpg", as(jpg) replace
						graph export "$dir/figures/figurea2.pdf", as(pdf) replace

						
						
					
* Table A.17: Prevalence of unresolved and violent disputes, heterogeneity by armed group governance

			foreach y of varlist unresolved_dum iverb_phys_dum {
						
				areg `y' assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					eststo `y'_HTE_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg `y' assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					eststo `y'_HTE_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				}
				
				esttab unresolved_dum_HTE_res unresolved_dum_HTE_lead iverb_phys_dum_HTE_res iverb_phys_dum_HTE_lead using "$dir/tables/tablea17.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") mgroups("\textbf{\shortstack{Any unresolved\\disputes}}" "\textbf{\shortstack{Any violent\\disputes}}" , pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
					
		
* Figure A.3: Prevalence of unresolved disputes, heterogeneity by armed groups governance

				areg unresolved_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_rebel_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (residents)", margin(medsmall)) ylabel(-.25(.25).75) ///
						xtitle("Assigned to treatment × rebel governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_rebel_res, replace)
						gr_edit .plotregion1.plot1.SetType rline
															
				areg unresolved_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_para_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (residents)", margin(medsmall)) ylabel(-.25(.25).75) ///
						xtitle("Assigned to treatment × paramilitary governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_para_res, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						
				areg unresolved_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_rebel_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (leaders)", margin(medsmall)) ylabel(-.25(.25).75) ///
						xtitle("Assigned to treatment × rebel governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_rebel_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline
															
				areg unresolved_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_para_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (leaders)", margin(medsmall)) ylabel(-.25(.25).75) ///
						xtitle("Assigned to treatment × paramilitary governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_para_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						
						graph combine hte_unresolved_rebel_res hte_unresolved_para_res hte_unresolved_rebel_lead hte_unresolved_para_lead
	
					gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
					gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
						
						graph export "$dir/figures/figurea3.jpg", as(jpg) replace
						graph export "$dir/figures/figurea3.pdf", as(pdf) replace
						 
* Figure A.4: Prevalence of violent disputes, heterogeneity by armed groups governance

				areg iverb_phys_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_rebel_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (residents)", margin(medsmall)) ylabel(-.2(.1).2) ///
						xtitle("Assigned to treatment × rebel governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_rebel_res, replace)
						gr_edit .plotregion1.plot1.SetType rline
															
				areg iverb_phys_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_para_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (residents)", margin(medsmall)) ylabel(-.2(.1).2) ///
						xtitle("Assigned to treatment × paramilitary governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_para_res, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						
				areg iverb_phys_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_rebel_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (leaders)", margin(medsmall)) ylabel(-.2(.1).2) ///
						xtitle("Assigned to treatment × rebel governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_rebel_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline
															
				areg iverb_phys_dum assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_c_para_gov_dum_alt, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (leaders)", margin(medsmall)) ylabel(-.2(.1).2) ///
						xtitle("Assigned to treatment × paramilitary governance", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_para_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						
						graph combine hte_violent_rebel_res hte_violent_para_res hte_violent_rebel_lead hte_violent_para_lead
	
					gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
					gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
						
						graph export "$dir/figures/figurea4.jpg", as(jpg) replace
						graph export "$dir/figures/figurea4.pdf", as(pdf) replace
							
							
							

* Table A.18: Prevalence of unresolved and violent disputes, heterogeneity by exposure to violence

			foreach y of varlist unresolved_dum iverb_phys_dum {
						
				areg `y' assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					eststo `y'_HTE_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				areg `y' assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					eststo `y'_HTE_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "OLS"

				}
				
				esttab unresolved_dum_HTE_res unresolved_dum_HTE_lead iverb_phys_dum_HTE_res iverb_phys_dum_HTE_lead using "$dir/tables/tablea18.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") mgroups("\textbf{\shortstack{Any unresolved\\disputes}}" "\textbf{\shortstack{Any violent\\disputes}}" , pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std) ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						

* Figure A.5: Prevalence of unresolved disputes, heterogeneity by exposure to violence

				areg unresolved_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_reb_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (residents)", margin(medsmall)) ylabel(-.5(.5)1.5) ///
						xtitle("Assigned to treatment × rebel violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_rebel_viol_res, replace)
						gr_edit .plotregion1.plot1.SetType rline
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"rebel violence"'
															
				areg unresolved_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_para_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (residents)", margin(medsmall)) ylabel(-.5(.5)1.5) ///
						xtitle("Assigned to treatment × paramilitary violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_para_viol_res, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"paramilitary violence"'
						
				areg unresolved_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_state_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (residents)", margin(medsmall)) ylabel(-.5(.5)1.5) ///
						xtitle("Assigned to treatment × government violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_gov_viol_res, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"government violence"'
						
				areg unresolved_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_reb_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (leaders)", margin(medsmall)) ylabel(-.5(.5)3) ///
						xtitle("Assigned to treatment × rebel violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_rebel_viol_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"rebel violence"'
															
				areg unresolved_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_para_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (leaders)", margin(medsmall)) ylabel(-.5(.5)3) ///
						xtitle("Assigned to treatment × paramilitary violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_para_viol_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"paramilitary violence"'
						
				areg unresolved_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_state_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any unresolved disputes (leaders)", margin(medsmall)) ylabel(-.5(.5)3) ///
						xtitle("Assigned to treatment × government violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_unresolved_gov_viol_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"government violence"'
						
						graph combine hte_unresolved_rebel_viol_res hte_unresolved_para_viol_res hte_unresolved_gov_viol_res hte_unresolved_rebel_viol_lead hte_unresolved_para_viol_lead hte_unresolved_gov_viol_lead
	
					gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
					gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
						
						graph export "$dir/figures/figurea5.jpg", as(jpg) replace
						graph export "$dir/figures/figurea5.pdf", as(pdf) replace
							

* Figure A.6: Prevalence of violent disputes, heterogeneity by exposure to violence

				areg iverb_phys_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_reb_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (residents)", margin(medsmall)) ylabel(-1(.2).4) ///
						xtitle("Assigned to treatment × rebel violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_rebel_viol_res, replace)
						gr_edit .plotregion1.plot1.SetType rline
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"rebel violence"'
															
				areg iverb_phys_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_para_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (residents)", margin(medsmall)) ylabel(-1(.2).4) ///
						xtitle("Assigned to treatment × paramilitary violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_para_viol_res, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"paramilitary violence"'
						
				areg iverb_phys_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==0, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_state_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (residents)", margin(medsmall)) ylabel(-1(.2).4) ///
						xtitle("Assigned to treatment × government violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_gov_viol_res, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"government violence"'
						
				areg iverb_phys_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_reb_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (leaders)", margin(medsmall)) ylabel(-2(.5)2) ///
						xtitle("Assigned to treatment × rebel violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_rebel_viol_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"rebel violence"'
															
				areg iverb_phys_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_para_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (leaders)", margin(medsmall)) ylabel(-2(.5)2) ///
						xtitle("Assigned to treatment × paramilitary violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_para_viol_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"paramilitary violence"'
						
				areg iverb_phys_dum assigned vict_reb_idx vict_para_idx vict_state_idx assigned_vict_reb_idx assigned_vict_para_idx assigned_vict_state_idx $i_ctrls $c_ctrls [pweight = IPW] if leader==1, cl(centercode) ab(block) 		
					marginscontplot2 assigned_vict_state_idx, ci ///
						lineopts(lcolor(black) lpattern(solid)) ///
						areaopts(lcolor(black) lpattern(-) ///
						ytitle("Any violent disputes (leaders)", margin(medsmall)) ylabel(-2(.5)2) ///
						xtitle("Assigned to treatment × government violence", margin(medsmall)) ///
						graphr(color(white))) ///
						name(hte_violent_gov_viol_lead, replace)
						gr_edit .plotregion1.plot1.SetType rline			
						gr_edit .xaxis1.title.text = {}
						gr_edit .xaxis1.title.text.Arrpush `"Assigned to treatment ×"'
						gr_edit .xaxis1.title.text.Arrpush `"government violence"'
						
						graph combine hte_violent_rebel_viol_res hte_violent_para_viol_res hte_violent_gov_viol_res hte_violent_rebel_viol_lead hte_violent_para_viol_lead hte_violent_gov_viol_lead
	
					gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
					gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
						
						graph export "$dir/figures/figurea6.jpg", as(jpg) replace
						graph export "$dir/figures/figurea6.pdf", as(pdf) replace
							
											
																					
									
			
* Table A.19: Reliance on armed groups and governmental and communal institutions to resolve disputes, heterogeneity by connectedness

			foreach y in rely_comm P7 P8 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned conn_l_m_dummy assigned_conn_l_m_dummy) controltest(assigned==0) x(assigned conn_l_m_dummy assigned_conn_l_m_dummy $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_HTE_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned conn_l_m_dummy assigned_conn_l_m_dummy) controltest(assigned==0) x(assigned conn_l_m_dummy assigned_conn_l_m_dummy $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_HTE_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				}
	
				esttab P8_HTE_res P8_HTE_lead rely_comm_HTE_res rely_comm_HTE_lead P7_HTE_res P7_HTE_lead using "$dir/tables/tablea19.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Reliance on \\ armed groups}}" "\textbf{Reliance on JACs}" "\textbf{\shortstack{Reliance on police \\ and PIs}}", pattern(1 0 1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(ae_assigned ae_conn_l_m_dummy ae_assigned_conn_l_m_dummy) ///
					coeflabel(ae_assigned "Assigned to treatment" ae_conn_l_m_dummy "Connected" ae_assigned_conn_l_m_dummy "Assigned to treatment $\times$ connected") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						


* Table A.20: Reliance on armed groups and governmental and communal institutions to resolve disputes, heterogeneity by armed group governance

			foreach y in rely_comm P7 P8 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt) controltest(assigned==0) x(assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_HTE_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt) controltest(assigned==0) x(assigned c_rebel_gov_dum_alt c_para_gov_dum_alt assigned_c_rebel_gov_dum_alt assigned_c_para_gov_dum_alt $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_HTE_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				}
	
				esttab P8_HTE_res P8_HTE_lead rely_comm_HTE_res rely_comm_HTE_lead P7_HTE_res P7_HTE_lead using "$dir/tables/tablea20.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Reliance on \\ armed groups}}" "\textbf{Reliance on JACs}" "\textbf{\shortstack{Reliance on police \\ and PIs}}", pattern(1 0 1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(ae_assigned ae_c_rebel_gov_dum_alt ae_c_para_gov_dum_alt ae_assigned_c_rebel_gov_dum_alt ae_assigned_c_para_gov_dum_alt) ///
					coeflabel(ae_assigned "Assigned to treatment" ae_c_rebel_gov_dum_alt "Rebel governance" ae_c_para_gov_dum_alt "Paramilitary governance" ae_assigned_c_rebel_gov_dum_alt "Assigned to treatment $\times$ rebel governance" ae_assigned_c_para_gov_dum_alt "Assigned to treatment $\times$ paramilitary governance") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						


* Table A.21: Reliance on armed groups and governmental and communal institutions to resolve disputes, heterogeneity by exposure to violence

			foreach y in rely_comm P7 P8 {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std) controltest(assigned==0) x(assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_HTE_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std) controltest(assigned==0) x(assigned vict_reb_idx_std vict_para_idx_std vict_state_idx_std assigned_vict_reb_idx_std assigned_vict_para_idx_std assigned_vict_state_idx_std $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_HTE_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				}
	
				esttab P8_HTE_res P8_HTE_lead rely_comm_HTE_res rely_comm_HTE_lead P7_HTE_res P7_HTE_lead using "$dir/tables/tablea21.tex", replace ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Reliance on \\ armed groups}}" "\textbf{Reliance on JACs}" "\textbf{\shortstack{Reliance on police \\ and PIs}}", pattern(1 0 1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(ae_assigned ae_vict_reb_idx_std ae_vict_para_idx_std ae_vict_state_idx_std ae_assigned_vict_reb_idx_std ae_assigned_vict_para_idx_std ae_assigned_vict_state_idx_std) ///
					coeflabel(ae_assigned "Assigned to treatment" ae_vict_reb_idx_std "Rebel violence" ae_vict_para_idx_std "Paramilitary violence" ae_vict_state_idx_std "Government violence" ///
					ae_assigned_vict_reb_idx_std "Assigned to treatment $\times$ rebel violence" ae_assigned_vict_para_idx_std "Assigned to treatment $\times$ paramilitary violence" ae_assigned_vict_state_idx_std "Assigned to treatment $\times$ government violence") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
						
			
		

	
	
	
* Table A.22: Reliance on armed groups and state and communal authorities to resolve disputes, disaggregated by jurisdiction

			foreach y in rely_comm_juris rely_comm_no_juris P7_juris P7_no_juris {
				
				avg_effect_weighted_reg $`y' if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $`y'_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo `y'_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"
						
				}
	
				esttab rely_comm_juris_ITT_res rely_comm_juris_ITT_lead rely_comm_no_juris_ITT_res rely_comm_no_juris_ITT_lead P7_no_juris_ITT_res P7_no_juris_ITT_lead P7_juris_ITT_res P7_juris_ITT_lead using "$dir/tables/tablea22.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{ \\ Reliance on JACs \\ (communal jurisdiction)}}" "\textbf{\shortstack{ \\ Reliance on JACs \\ (state jurisdiction)}}" "\textbf{\shortstack{Reliance on police \\ and PIs \\ (communal jurisdiction)}}" "\textbf{\shortstack{Reliance on police \\ and PIs \\ (state jurisdiction)}}", pattern(1 0 1 0 1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 

	
	
	
* Table A.23: Consensus around dispute resolution, alternate constructions of the DV

				avg_effect_weighted_reg $P5_match_res if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P5_match_res_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $P5_match_res if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P5_match_res_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $P5_match_lead if leader==0, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P5_match_lead_ITT_res
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				avg_effect_weighted_reg $P5_match_lead if leader==1, effectvar(assigned) controltest(assigned==0) x(assigned $i_ctrls $c_ctrls $block_FE) cl(centercode) ap(IPW)
					eststo P5_match_lead_ITT_lead
						estadd local i_ctrls "Yes"
						estadd local c_ctrls "Yes"
						estadd local block_FE "Yes"
						estadd local weights "Yes"
						estadd local estimator "AES"

				esttab P5_match_res_ITT_res P5_match_res_ITT_lead P5_match_lead_ITT_res P5_match_lead_ITT_lead using "$dir/tables/tablea23.tex", replace ///
					rename(ae_assigned assigned) ///
					label booktabs b(3) se(3) eqlabels(none) br ///
					mtitle("Residents" "Leaders" "Residents" "Leaders") ///
					mgroups("\textbf{\shortstack{Consensus around \\ dispute resolution \\ (modal resident)}}" "\textbf{\shortstack{Consensus around \\ dispute resolution \\ (modal leader)}}", pattern(1 0 1 0) ///
					prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
					keep(assigned) coeflabel(assigned "Assigned to treatment") ///
					star(* 0.10 ** 0.05 *** 0.01) nonotes scalars("i_ctrls Individual controls" "c_ctrls Community controls" "block_FE Block FE" "weights Weights" "estimator Estimator" ) 
				

	
	
	
	
	
	
	
	
	
